<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet"
	type="text/css" />
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet"
	type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>新增文章分类</title>
</head>
<body>
	<div class="pd-20">
		<form action="<%=basePath%>backstage/cate-add" method="post"
			class="form form-horizontal" id="form-u_cate-add">
			<input type="hidden" id="id" name="id" value='${u_cate.id}' />


			<div class="row cl">
				<label class="form-label col-2"><span class="c-red">*</span>类名：</label>
				<div class="formControls col-4">
					<input type="text" class="input-text" value="${u_cate.cate_name}"
						placeholder="" id="" name="cate_name" datatype="*" nullmsg="不能为空">
				</div>
				<label class="form-label col-1"><span class="c-red">*</span>顺序：</label>
				<div class="formControls col-1">
					<input type="text" class="input-text" value="${u_cate.sort}"
						placeholder="" id="" name="sort" datatype="n" nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2"><span class="c-red">*</span>父分类：</label>
				<div class="formControls col-4">
					<select name="parent_id" class="select">
						<option <c:if test="${u_cate.parent_id==-1}">selected</c:if>
							value="0">默认</option>
						<c:forEach items="${cates}" var="cate">
							<option value="${cate.id}"
								<c:if test="${cate.id==u_cate.parent_id}">selected</c:if>>${cate.cate_full_name}</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2"><span class="c-red">*</span>类型：</label>
				<div class="formControls col-3">
					<select name="cate_type" class="select" datatype="*" nullmsg="不能为空">

						<c:forEach items="${article_types}" var="article_type">
							<option value="${article_type.item_value}"
								<c:if test="${article_type.item_value==u_cate.cate_type}">selected</c:if>>${article_type.display_name}</option>
						</c:forEach>
					</select>
				</div>
				<div class="formControls col-2">
					<a onClick="enums_list_child(this,'5')" href="javascript:void(0);">添加</a>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">关键字：</label>
				<div class="formControls col-6">
					<input type="text" class="input-text" value="${u_cate.keywords}"
						placeholder="分号分隔: A;B;C " id="keywords" name="keywords">
				</div>
			</div>

			<div class="row cl">
				<label class="form-label col-2">标签：</label>
				<div class="formControls col-8">
					<c:forEach items="${labels}" var="label">
						<div style="line-height: 28px;">
							<input type='checkbox' name='labels' value='${label.label_name}'>&nbsp;<label
								style='font-weight: bold'>${label.label_name}</label>
							:&nbsp;&nbsp;
							<c:forEach items="${label.child}" var="child_label">
								<label>${child_label.label_name}</label> &nbsp;&nbsp;
					</c:forEach>
						</div>
					</c:forEach>
				</div>
			</div>

			<div class="row cl">
				<label class="form-label col-2">分类描述：</label>
				<div class="formControls col-8">
					<input type="text" class="input-text" value="${u_cate.cate_desc}"
						placeholder="" id="" name="cate_desc">
				</div>
			</div>


			<div class="row cl">
				<label class="form-label col-2">是否有效：</label>
				<div class="formControls col-5">
					<input type="radio" name="is_valid" datatype="n" nullmsg="请选择！"
						value="0" checked="true"
						<c:if test='${0==u_cate.is_valid}'>checked="true"</c:if>>
					否 &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="is_valid"
						datatype="n" nullmsg="请选择！" value="1"
						<c:if test='${1==u_cate.is_valid}'>checked="true"</c:if>>
					是
				</div>
			</div>

			<div class="row cl">
				<label class="form-label col-2">允许评论：</label>
				<div class="formControls col-5">
					<input type="radio" name="allow_comment" datatype="n"
						nullmsg="请选择！" value="0" checked="true"
						<c:if test='${0==u_cate.allow_comment}'>checked="true"</c:if>>
					不允许 &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio"
						name="allow_comment" datatype="n" nullmsg="请选择！" value="1"
						<c:if test='${1==u_cate.allow_comment}'>checked="true"</c:if>>
					允许
				</div>
			</div>

			<div class="row cl">
				<label class="form-label col-2">是否显示日期：</label>
				<div class="formControls col-5">
					<input type="radio" name="is_show_date" datatype="n" nullmsg="请选择！"
						value="0" checked="true"
						<c:if test='${0==u_cate.is_show_date}'>checked="true"</c:if>>
					不显示 &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio"
						name="is_show_date" datatype="n" nullmsg="请选择！" value="1"
						<c:if test='${1==u_cate.is_show_date}'>checked="true"</c:if>>
					显示
				</div>
			</div>

			<div class="row cl">
				<div class="col-10 col-offset-2">
					<button onClick="u_cate_save_submit();"
						class="btn btn-primary radius" type="submit">保存并提交</button>
					<button onClick="layer_close();" class="btn btn-default radius"
						type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
				</div>
			</div>
		</form>
	</div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="lib/icheck/jquery.icheck.min.js"></script>
	<script type="text/javascript"
		src="lib/Validform/5.3.2/Validform.min.js"></script>
	<script type="text/javascript"
		src="lib/webuploader/0.1.5/webuploader.min.js"></script>
	<script type="text/javascript"
		src="lib/ueditor/1.4.3/ueditor.config.js"></script>
	<script type="text/javascript"
		src="lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
	<script type="text/javascript"
		src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript">

$(function(){
	// chkItem事件
	$("[name = labels]:checkbox").bind("click", function () {
		var $chk = $(this);
		var checked=$chk.prop("checked");
		//alert(checked);
		if($("#keywords").val().length<=0){
			if(checked){
				$("#keywords").val($chk.val());
			}
		}else{
			if(checked){
				$("#keywords").val($("#keywords").val()+";"+$chk.val());
			}else{
				var k_values = $("#keywords").val();
				k_values = k_values.replace(";"+$chk.val(),"");
				$("#keywords").val(k_values);
			}
		}
	})
})

function u_cate_save_submit(){
	$("#form-u_cate-add").Validform({
		tiptype:2,
		ajaxPost:true,
		callback:function(form){
			var index = parent.layer.getFrameIndex(window.name);
			parent.$('.btn-refresh').click();
			parent.layer.close(index);	
		}
	});
}

/*查看数据字典下一级*/
function enums_list_child(obj,id,w,h){
	var edit_page = "<%=basePath%>backstage/enums-list?id=" + id;
			layer_show('查看文章类型', edit_page, w, h);
		}
	</script>
</body>
</html>

